<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script>
	function toPage(){
		var pageIndex=document.getElementById("pageIndex").value;
		if(pageIndex>${pageCount}){
			pageIndex=${pageCount};
			alert('超过总页数了');
		}
		
		
		location.href="ToBoardServlet?pageIndex="+pageIndex;
	}

</script>
<body>
	<table border="1">
		<tr>
			<th>编号</th>
			<th>名称</th>
		</tr>	
	
	<c:forEach items="${boardList }" var="board">
		<tr>
			<td>${board.bid }</td>
			<td>${board.bname }</td>
		</tr>
	</c:forEach>
		<tr>
			<td colspan="2">
				<span>当前第${currPage }页</span>			
				<a href="ToBoardServlet?pageIndex=1">首页</a>|
				<a href="ToBoardServlet?pageIndex=${currPage-1 }">上一页</a>|
				<a href="ToBoardServlet?pageIndex=${currPage+1 }">下一页</a>|
				<a href="ToBoardServlet?pageIndex=${pageCount}">尾页</a>|
				跳到
				<input type="text" size="1" name="pageIndex" id="pageIndex">页
				<input type="button" size="2" onclick="toPage()" value="Go">
				
			</td>		
		</tr>
	</table>
</body>
</html>